#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>

#include <unistd.h>

int main() {
	int ret;
	pid_t pid;
	pthread_mutex_t mutex;
	pthread_mutex_init(&mutex, NULL);
	pthread_mutex_lock(&mutex);
	
	if ((pid=fork()) < 0) {
		printf("fork error\n");
	}
	else if ((pid == 0)) {
		ret = pthread_mutex_destroy(&mutex);
		printf("child  %d: %s\n", ret, strerror(ret));
	}
	else {
		ret = pthread_mutex_destroy(&mutex);
		printf("parent  %d: %s\n", ret, strerror(ret));
	}
		
	return 0;
}
